﻿using System;

namespace HEFramework
{
    public interface IDestroy
    {
    }

    public interface IDestroySystem : ISystemType
    {
        void Run(Entity _o);
    }

    [EntitySystem]
    public abstract class DestroySystem<T> : IDestroySystem where T : Entity, IDestroy
    {
        Type ISystemType.Type()
        {
            return typeof(T);
        }

        Type ISystemType.SystemType()
        {
            return typeof(IDestroySystem);
        }

        int ISystemType.GetInstanceQueueIndex()
        {
            return InstanceQueueIndex.None;
        }

        void IDestroySystem.Run(Entity _o)
        {
            this.Destroy((T)_o);
        }

        protected abstract void Destroy(T _self);
    }
}